<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid  name="wxComponentAccountList" checkbox="true" fitColumns="false" title="第三方平台账户" actionUrl="wxComponentAccountController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人名称"  field="createName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人登录名称"  field="createBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建日期"  field="createDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人名称"  field="updateName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人登录名称"  field="updateBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新日期"  field="updateDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="所属部门"  field="sysOrgCode"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="所属公司"  field="sysCompanyCode"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="名称"  field="name"   queryMode="single" query="true" width="160"></t:dgCol>
   <t:dgCol title="APPID"  field="appId"  queryMode="single" query="true" width="150"></t:dgCol>
   <t:dgCol title="AppSecret"  field="appSecret"    queryMode="single" hidden="true"  width="120"></t:dgCol>
   <t:dgCol title="验证凭据"  field="verifyTicket"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="接口调用凭据"  field="accessToken"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="接口调用凭据有效期"  field="accessTokenExpiresIn"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="预授权码"  field="preAuthCode "  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="预授权码有效期"  field="preAuthCodeExpiresIn"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="域名"  field="domain"    queryMode="single"  width="120" hidden="true"></t:dgCol>
   <%-- <t:dgCol title="消息推送令牌"  field="token"    queryMode="single"  width="120"></t:dgCol> --%>
   <t:dgCol title="消息加密秘钥"  field="aesKey"    queryMode="single"  hidden="true" width="120" ></t:dgCol>
   <t:dgCol title="当前账户"  field="isCurrentAccount"  queryMode="single"  width="100" formatterjs="ftmBoolean" ></t:dgCol>
   <t:dgCol title="操作" field="opt" width="150" ></t:dgCol>
 
   <t:dgDelOpt title="删除" url="wxComponentAccountController.do?doDel&id={id}"/>
   <t:dgDefOpt title="授权页面" url="wxComponentAccountController.do?authorPage&appId={appId}" target="_parent" />
   
   <t:dgToolBar  title="录入" icon="icon-add" url="wxComponentAccountController.do?goAdd" funname="add"></t:dgToolBar>
   <t:dgToolBar title="编辑" icon="icon-edit" url="wxComponentAccountController.do?goUpdate" funname="update"></t:dgToolBar>
   <t:dgToolBar title="批量删除"  icon="icon-remove" url="wxComponentAccountController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="wxComponentAccountController.do?goUpdate" funname="detail"></t:dgToolBar>
  
   <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
   <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
   <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
   <t:dgToolBar title="设置为当前账户" icon="icon-search" funname="setCurrentAccount" ></t:dgToolBar>
  </t:datagrid>
  </div>
 </div>
 <script src = "webpage/com/gomore/wechat/component/account/wxComponentAccountList.js"></script>
 
 <script type="text/javascript">
 $(document).ready(function(){
 		//给时间控件加上样式
 			$("#wxComponentAccountListtb").find("input[name='createDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 			$("#wxComponentAccountListtb").find("input[name='updateDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 
 
//导入
function ImportXls() {
	openuploadwin('Excel导入', 'wxComponentAccountController.do?upload', "wxComponentAccountList");
}

//导出
function ExportXls() {
	JeecgExcelExport("wxComponentAccountController.do?exportXls","wxComponentAccountList");
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("wxComponentAccountController.do?exportXlsByT","wxComponentAccountList");
}

function setCurrentAccount(id){
	if(!isSelected()){
		return;
	}
	$.post("wxComponentAccountController.do?setCurrentAccount",{id:getSelectedRecordId()}, function(data) {
		var d = $.parseJSON(data);
		if (d.success) {
			$.messager.show({
				title : '提示',
				msg : d.msg,
				showType : 'show'
			});
			reloadTable();
		}
	});
}

function getSelectedRecordId() {
	var rows = $('#wxComponentAccountList').datagrid('getSelections');
	return rows[0]["id"]
}

function isSelected(){
	var rows = $('#wxComponentAccountList').datagrid('getSelections');
	if(rows.length == 1){
		return true;
	} else{
		$.messager.show({
			title : '提示',
			msg : '请选择一条记录',
			showType : 'show'
		});
		return false;
	}
}

function ftmBoolean(value,row,inde) {
  return value? "是": "否";
}
 </script>